class User {
    constructor(name, age) {
        this.name = name;
        this.age = age;
    }

    toString() {
        return this.name + "," + this.age;
    }

    getName() {
        return this.name;
    }

    getAge() {
        return this.age;
    }
}

var user;

function setVal() {
    let name = document.getElementById("name").value;
    let age = document.getElementById("age").value;
    user = new User(name, age);
    console.log(user);
    alert(user.getName());
}


